import numpy as np
# 1. 一维数组
arr1 = np.array([1,2,3,4,5])
print("=== 一维数组 ===")
print("内容：", arr1, " 形状：", arr1.shape, " 类型：", arr1.dtype)
# 2. 二维数组
arr2 = np.array([[1,2,3],[4,5,6],[7,8,9]])
print("\n=== 二维数组 ===")
print("内容：\n", arr2, " 形状：", arr2.shape)
# 3. 特殊数组
zeros_arr = np.zeros((2,4))  # 全0
ones_arr = np.ones((3,2))    # 全1
print("\n=== 特殊数组 ===")
print("全0数组：\n", zeros_arr, "\n全1数组：\n", ones_arr)

# 1. 算术运算
print("=== 算术运算 ===")
print("arr1 + 2：", arr1 + 2, " arr1 * 3：", arr1 * 3)
arr3 = np.array([6,7,8,9,10])
print("arr1 + arr3：", arr1 + arr3)
# 2. 统计计算
print("\n=== 统计计算 ===")
print("arr2均值：", np.mean(arr2), " 总和：", np.sum(arr2))
print("arr2按列均值：", np.mean(arr2, axis=0), " 按行求和：", np.sum(arr2, axis=1))
# 3. 矩阵运算
print("\n=== 矩阵运算 ===")
mat1 = np.array([[1,2],[3,4]])
mat2 = np.array([[5,6],[7,8]])
print("矩阵乘法：\n", np.dot(mat1, mat2), " 转置：\n", mat1.T)